<template>
  <div class="login">
    <div class="loginbox">
      <p>猫之巢</p>
      <span class="lable">用户名：</span>
      <el-input v-model="username" placeholder="用户名"></el-input><br />
      <span class="lable">密码：</span>
      <el-input v-model="password" placeholder="密码" type="password"></el-input>
      <el-button type="warning" round @click="login()">登录</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: "CatcoffeeLogin",

  data() {
    return {
      username: "",
      password: "",
    };
  },

  mounted() {},

  methods: {
    login() {
      this.$axios
        .post("/staff/login", {
          username: this.username,
          password: this.password,
        })
        .then(({ data }) => {
          if (data.code == 200) {
            window.localStorage.setItem("staff", JSON.stringify(data.data));
            this.$router.push("/product");
            this.$notify.success({
              title: "",
              message: "登录成功！！！",
            });
          } else {
            this.$notify.error({
              title: "用户名密码错误",
              message: "请重新输入！！！",
            });
          }
          console.log(data);
        });
    },
  },
};
</script>

<style scoped>
.login {
  display: flex;
  justify-content: center;
  align-items: center;
  align-content: center;
  height: 100%;
  background: url('../assets/catbackground.jpg') no-repeat;
  background-size: cover;
}
.loginbox {
  text-align: center;
  background: rgba(255, 255, 255,0.3);
  backdrop-filter: blur(15px);
  width: 500px;
  border-radius: 10px;
  padding: 20px 20px 60px 20px;
  color: white;
  font-size: 15px;
  font-weight: 600;
  box-shadow:2px 2px 20px #000000;
  text-shadow: 1px 1px 5px #000000;
}
.loginbox > p {
  font-size: 30px;
}

::v-deep .loginbox .el-input .el-input__inner,
.loginbox .el-input {
  width: 300px;
  display: inline-block;
  margin-top: 10px;
}
.el-input__icon::before{
  display: inline-block;
  height: 20px;
}
.loginbox span {
  display: inline-block;
  width: 70px;
}
.loginbox button {
  text-align: center;
  margin-top: 40px;
  border-radius: 50px;
  width: 300px;
}

</style>